/*
 *  fliperama.c
 *  
 *  http://br.spoj.pl/problems/FLIPERAM/
 *  Created by Bruno Dias on 24/04/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#include <stdio.h>
#include <math.h>
#include <stdlib.h>


int comp_int(const * x, const * y) {
	if ( *(int*)x > *(int*)y )
		return 1;
	else if ( *(int*)x == *(int*)y )
		return 0;
	else if ( *(int*)x < *(int*)y )
		return -1;
}

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	int pontos[n];
	int i = 0;
	while (i < n) {
		scanf("%d", &pontos[i++]);
	}
	qsort(&pontos, n, sizeof(int), (void*) comp_int);
	m = n - m - 1;
	for (i = n -1 ; i > m; i--) {
		printf("%d\n", pontos[i]);
	}
	return EXIT_SUCCESS;
}